<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang"ja" lang="ja">
<head>
    <title>作業時間管理 on GAE | ユーザ情報</title>
    <link type="text/css" rel="stylesheet" href="/stylesheets/default.css"/>
    <link type="text/css" rel="stylesheet" href="/stylesheets/alert.css"/>
    <link type="text/css" rel="stylesheet" href="/stylesheets/alphacube.css"/>    
    <script type="text/javascript" src="/scripts/prototype.js"> </script>
    <script type="text/javascript" src="/scripts/effects.js"> </script>
    <script type="text/javascript" src="/scripts/window.js"> </script>
    <script type="text/javascript" src="/scripts/window_effects.js"> </script>
    <script type="text/javascript" src="/scripts/debug.js"> </script>
 	<!-- mfkd libraly //-->   
    <link type="text/css" rel="stylesheet" href="/stylesheets/workingtimeinput.css" />    
	<script type="text/javascript" src="/scripts/mfkd.js"></script>
	<script type="text/javascript">
		{% if not userinfo.userid or errmsg %}
		window.onload = function() {
			Focus.Index = {userid:"passwd",
							passwd:"repasswd",
							repasswd:"kaishi",
							kaishi:"syuryo",
							syuryo:"jitudo",
							jitudo:"zan_futu",
							zan_futu:"zan_sinya",
							zan_sinya:"zan_gokei",
							zan_gokei:"simebi",
							simebi:"enter"};
		    //
		    $("userid").onfocus    = function() { Focus.GotFocus(this);};
		    $("userid").onblur     = function() { Focus.LostFocus(this); };
		    $("userid").focus();
		    //
		    $("passwd").onfocus    = function() { Focus.GotFocus(this);};
		    $("passwd").onblur     = function() { Focus.LostFocus(this); };
		{% else %}
			window.onload = function() {
				Focus.Index = {	passwd:"repasswd",
								repasswd:"kaishi",
								kaishi:"syuryo",
								syuryo:"jitudo",
								jitudo:"zan_futu",
								zan_futu:"zan_sinya",
								zan_sinya:"zan_gokei",
								zan_gokei:"simebi",
								simebi:"enter"};
		    //
		    $("passwd").onfocus    = function() { Focus.GotFocus(this);};
		    $("passwd").onblur     = function() { Focus.LostFocus(this); };
		    $("passwd").focus();
		{% endif %}
		    $("repasswd").onfocus    = function() { Focus.GotFocus(this);};
		    $("repasswd").onblur     = function() { Focus.LostFocus(this); };
		    //
		    $("kaishi").onfocus    = function() { Focus.GotFocus(this);};
		    $("kaishi").onblur     = function() { Focus.LostFocus(this); };
		    //
		    $("syuryo").onfocus    = function() { Focus.GotFocus(this);};
		    $("syuryo").onblur     = function() { Focus.LostFocus(this); };
		    //
		    $("jitudo").onfocus    = function() { Focus.GotFocus(this);};
		    $("jitudo").onblur     = function() { Focus.LostFocus(this); };
		    //
		    $("zan_futu").onfocus    = function() { Focus.GotFocus(this);};
		    $("zan_futu").onblur     = function() { Focus.LostFocus(this); };
		    //
		    $("zan_sinya").onfocus    = function() { Focus.GotFocus(this);};
		    $("zan_sinya").onblur     = function() { Focus.LostFocus(this); };
		    //
		    $("zan_gokei").onfocus    = function() { Focus.GotFocus(this);};
		    $("zan_gokei").onblur     = function() { Focus.LostFocus(this); };
		};
		function keypress(event, id) {
	        // ｷｰの取得
	        if (event.keyCode != 0) { key = event.keyCode; }
	        else { key = event.charCode; }
	        
	        if ( id == "userid" ) { Validator.Validation($(id), key, {"NotEmpty":"", "IsEmail":""}); }
	        if ( id == "passwd" ) { Validator.Validation($(id), key, {"NotEmpty":"", "SameValue":"repasswd"}); }
	        if ( id == "repasswd" ) { Validator.Validation($(id), key, {"NotEmpty":"", "SameValue":"passwd"}); }
	        if ( id == "kaishi" ) { Validator.Validation($(id), key, {"IsTime":""}); }
	        if ( id == "syuryo" ) { Validator.Validation($(id), key, {"IsTime":""}); }
	        if ( id == "jitudo" )    { Validator.Validation($(id), key, {"IsNumeric":""}); }
	        if ( id == "zan_futu" )  { Validator.Validation($(id), key, {"IsNumeric":""}); }
	        if ( id == "zan_sinya" ) { Validator.Validation($(id), key, {"IsNumeric":""}); }
	        if ( id == "zan_gokei" ) { Validator.Validation($(id), key, {"IsNumeric":""}); }
		};
		function check() {
			var err = "";

			{% if not userinfo.userid %}
			err = Validator.NotEmpty($("userid").value);
			if (err != "") {
				Validator.ShowAlert($("userid"), err);
				return false;
			};
			err = Validator.IsEmail($("userid").value);
			if (err != "") {
				Validator.ShowAlert($("userid"), err);
				return false;
			};
			{% endif %}
			
			err = Validator.NotEmpty($("passwd").value);
			if (err != "") {
				Validator.ShowAlert($("passwd"), err);
				return false;
			};
			err = Validator.NotEmpty($("repasswd").value);
			if (err != "") {
				Validator.ShowAlert($("repasswd"), err);
				return false;
			};
			err = Validator.SameValue($("passwd").value, "repasswd");
			if (err != "") {
				Validator.ShowAlert($("repasswd"), err);
				return false;
			};

			err = Validator.IsTime($("kaishi").value);
			if (err != "") {
				Validator.ShowAlert($("kaishi"), err);
				return false;
			};
			err = Validator.IsTime($("syuryo").value);
			if (err != "") {
				Validator.ShowAlert($("syuryo"), err);
				return false;
			};
			err = Validator.IsNumeric($("jitudo").value);
			if (err != "") {
				Validator.ShowAlert($("jitudo"), err);
				return false;
			};
			err = Validator.IsNumeric($("zan_futu").value);
			if (err != "") {
				Validator.ShowAlert($("zan_futu"), err);
				return false;
			};
			err = Validator.IsNumeric($("zan_sinya").value);
			if (err != "") {
				Validator.ShowAlert($("zan_sinya"), err);
				return false;
			};
			err = Validator.IsNumeric($("zan_gokei").value);
			if (err != "") {
				Validator.ShowAlert($("zan_gokei"), err);
				return false;
			};
		
			document.myform.submit();
		};
	</script> 	
</head>
<body>
	<!-- メニュー -->
	<div class="menu">
		<p>&nbsp;</p>
	</div>
    <!-- コンテンツ -->
	<div class="contents">
		{% if not userinfo.userid or errmsg %}
		<p class="title">ユーザ登録</p>
		{% else %}	
		<p class="title">ユーザ情報</p>
		{% endif %}
		<div id="errmsg">{{ errmsg }}</div>
	    <form name="myform" action="/Registration" method="post">
	    	<br />
			{% if not userinfo.userid or errmsg %}
				<p><label for="userid">メールアドレス</label>：</p>
				<p><input type="text" id="userid" name="userid" value="{{userinfo.userid}}" onkeypress="keypress(event, 'userid');" />（必須）<p>
			{% else %}
				<p><label for="userid">メールアドレス</label>：<span>{{userinfo.userid}}</span><p>
				<input type="hidden" name="userid" value="{{userinfo.userid}}" />
			{% endif %}
			<p><label for="passwd">パスワード</label>：<p>
			<p><input type="password" id="passwd" name="passwd" value="{{userinfo.passwd}}" onkeypress="keypress(event, 'passwd');" />（必須）</p>
			<p><label for="repasswd">パスワード（確認用）</label>：<p>
			<p><input type="password" id="repasswd" name="repasswd" value="{{userinfo.passwd}}" onkeypress="keypress(event, 'repasswd');" />（必須）</p>
			<br />
			<p>初期値：</p>
		    <table>
		        <tr class="header">
		            <th>作業開始</th>
		            <th>作業終了</th>
		            <th>実働時間</th>
		            <th>普通残業</th>
		            <th>深夜残業</th>
		            <th>残業合計</th>
		            <th>締日</th>
		        </tr>
		        <tr>
		            <td><input type="text" id="kaishi" name="kaishi" size="6" maxlength="5" value="{{ userinfo.kaishi }}" onkeypress="keypress(event, 'kaishi');" /></td>
		            <td><input type="text" id="syuryo" name="syuryo" size="6" maxlength="5" value="{{ userinfo.syuryo }}" onkeypress="keypress(event, 'syuryo');" /></td>
		            <td><input type="text" id="jitudo" name="jitudo" size="6" maxlength="5" value="{{ userinfo.jitudo }}" onkeypress="keypress(event, 'jitudo');" /></td>
		            <td><input type="text" id="zan_futu" name="zan_futu" size="6" maxlength="5" value="{{ userinfo.zan_futu }}" onkeypress="keypress(event, 'zan_futu');" /></td>
		            <td><input type="text" id="zan_sinya" name="zan_sinya" size="6" maxlength="5" value="{{ userinfo.zan_sinya }}" onkeypress="keypress(event, 'zan_sinya');" /></td>
		            <td><input type="text" id="zan_gokei" name="zan_gokei" size="6" maxlength="5" value="{{ userinfo.zan_gokei }}" onkeypress="keypress(event, 'zan_gokei');" /></td>
		            <td>
						<select id="simebi" name="simebi">
							{{ simebi }}
						</select>
					</td>
		        </tr>
		    </table>
		    <br />
	        <input type="button" id="enter" value="登録" onclick="check()"/><input type="reset" id="reset" value="リセット"/>
	    </form>
    </div>
</body>
</html>